###类的继承

#定义父类
class Person:
    def __init__(self,name,age,sex):
        self.name = name
        self.age = age
        self.sex = sex
    def intro(self):
        print(f"我叫{self.name}，我今年{self.age}岁")

#定义子类
class Student(Person):
    def __init__(self, name, age, sex,sid):
        #调用父类的构造函数
        super().__init__(name, age, sex)
        #初始化子类特有的属性
        self.sid = sid
    #子类特有的方法
    def get_sid(self):
        return self.sid

#定义子类
class Teacher(Person):
    def __init__(self, name, age, sex,tid):
        #调用父类的构造函数
        super().__init__(name, age, sex)
        #初始化子类特有的属性
        self.tid = tid
    #子类特有的方法
    def get_tid(self):
        return self.tid
    
person = Person('Red',18,'男')
student = Student('Blue',20,'女','s0001')
teacher = Teacher('Green',36,'女','t0001')

person.intro()
print(person.sex)

student.intro()
print(student.sex)

teacher.intro()
print(teacher.sex)